﻿#!/usr/bin/env python
#coding:utf-8
from probe.core.level import *
from commands import *
import os
def getload(args):
    '''监控系统负载'''
    cores = getoutput("cat /proc/cpuinfo |grep cores|awk '{print $NF}'|head -1")
    #physical = getoutput("cat /proc/cpuinfo |grep physical|awk '{print $NF}'|head -1")
    WarningData = int(cores)
    result = os.getloadavg()
    for load in result:
        if float(load) >= WarningData:
            return WarningData({'系统负载': [float(load), '负载']})
    return InfoData({'系统负载': [float(load), '负载']})
if __name__ == '__main__':
    print getload()
